package com.gzcc.repository;

import com.gzcc.model.Category;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

/**
 * 描述: 商品分类数据操作
 *
 * @Author: Mr.Zhong
 * @Date: 2018/6/13
 */
@Repository
@Transactional
public interface CategoryRepository extends JpaRepository<Category, Integer> {

    /**
     * 描述: 根据品牌名查询分类
     *
     * @param
     * @return
     * @Author: Mr.Zhong
     * @Date: 2018/6/13
     */
    @Query(value = "select * from category u where u.title like %?1%", nativeQuery = true)
    List<Category> findAllByCategoryNameLike(String title);
}
